package com.bdsy.business.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bdsy.business.dao.ReceiveGoodMapper;
import com.bdsy.business.model.ReceiveGood;
import com.bdsy.business.service.ReceiveGoodService;

@Service("receiveGoodService")
public class ReceiveGoodServiceImpl implements ReceiveGoodService {

	@Autowired
	ReceiveGoodMapper receiveGoodMapper;
	
	@Override
	public boolean add(ReceiveGood receiveGood) {
		int number = (int)((Math.random()*9+1)*10000000);
		receiveGood.setReId(number);
		int result = receiveGoodMapper.insert(receiveGood);
		return result>0?true:false;
	}

	@Override
	public List<ReceiveGood> receiveGoodListById(String userId) {
		List<ReceiveGood> receiveGoodList = receiveGoodMapper.receiveGoodListById(userId);
		return receiveGoodList;
	}

	@Override
	public boolean update(ReceiveGood receiveGood) {
		int result = receiveGoodMapper.update(receiveGood);
		return result>0?true:false;
	}

	@Override
	public boolean delete(int reId) {
		int result = receiveGoodMapper.delete(reId);
		return result>0?true:false;
	}

}
